# ---------- ---------- ---------- ---------- ---------- ----------
#
#   static-site-generator
#
# ---------- ---------- ---------- ---------- ---------- ----------


site_name=$(if $(n),$(n),Site)


target: help


.PHONY: help
help:
	@echo "Usage: make [PHONY]"
	@sed -n -e '/sed/! s/\.PHONY: //p' Makefile


.PHONY: init
init:
	@cp -air example/ content/


.PHONY: deps
deps:
	git clone https://github.com/hniksic/emacs-htmlize.git bin/htmlize


.PHONY: publish
publish:
	@cd content/ && make build
	@cd content/site/ && ../../src/main.el


.PHONY: rss
rss:
	@cd output/ && ../src/generate-rss.sh $(site_name)


.PHONY: build
build: publish rss


.PHONY: rebuild
rebuild: clean build


.PHONY: reset
reset:
	@./src/reset-timestamps.el


.PHONY: clean
clean: reset
	@cd content/ && make clean
	@rm -rf output/
